package edu.sctu.nieyu.day20150606.trainsystem;

import java.util.Calendar;
import java.util.HashMap;

/**
 * Created by user01 on 2015/6/11.
 */
public class JournyTime2 {

    Passenger passenger = new PassengerData().passengerData().get(0);
    private Calendar journyTime;

    public void setJournyTime(Calendar journyTime) {
        this.journyTime = journyTime;
    }

    public Calendar getJournyTime() {
        return journyTime;
    }

    Calendar calendar = Calendar.getInstance();
    public void getStartTime(){

        setJournyTime(calendar);
        System.out.println(passenger.getName()+"的进站时间为："+getJournyTime().getTime());
    }
    public void getEndTime(){

        TrainData trainData = new TrainData();
        HashMap<String ,Integer> map;
        map = trainData.hashMapData();
        int count = 0;//每个站五分钟；
         count =Math.abs((map.get(passenger.getEnd())) - (map.get(passenger.getStart())))*5;//

        getJournyTime().add(Calendar.MINUTE,count);

        System.out.println(passenger.getName()+"的出站时间为："+getJournyTime().getTime());
    }
}
